More and more websites are utilizing ECMAscript-based scripting languages (e.g., JavaScript® or Flash®) in connection with the dynamic content that they host. Additionally, websites increasingly utilize functionality embedded in other types of software code, such as style sheet languages and markup languages. Current websites frequently utilize JavaScript-based content. Internet browsers on computing devices have several components that execute code written in various languages on the processors of these computing devices. For example, sections of JavaScript code are run by a JavaScript engine, which may be realized by a variety of technologies, including interpretation-type engines, HotSpot just-in-time (JIT) compilation (e.g., trace based or function based), and traditional-function-based JIT compilation where native code is generated for the entire body of all the functions that get executed.
JavaScript-based engines compile the scripts at runtime to native code, and then the native code is executed on the processor hardware. As a consequence, a browser that uses a JavaScript-based JavaScript engine compiles and executes each piece of JavaScript code as soon as the code is found while parsing the HTML file. Often, this causes sections of JavaScript code to be executed repeatedly. Other types of software scripts are repeatedly executed by other components of the browser.
An end-user of a computing device commonly opens multiple tabs in a web browser at the same time, but the end-user is generally only active in one or two tabs at a time. Tabs may be left open and run in the background for long periods of time, and because of how the websites are written, they may consume power by continuously executing JavaScript and other types of code (e.g., to recalculate style and layout). These websites may or may not perform useful functions while running in the background. Certain websites update in the background quite frequently. This execution of scripts in background tabs occurs periodically and consumes device resources, including battery and processing power.
As a consequence, improved apparatus and methods that reduce the power required for scripting-language processing in background tabs are desired.